package com.gaofeng.day20;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class demo03 {
    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();

        Collections.addAll(list,"张三","李四","王五","赵六","刘七","男1","男2","女1","女2","女3");
//        Random rd = new Random();
//        int index = rd.nextInt(list.size());
//        String name = list.get(index);
//        System.out.println(name);
        Collections.shuffle(list);

        System.out.println(list.get(0));


        ArrayList<Integer> nums = new ArrayList<>();
        Collections.addAll(nums,1,1,1,1,1,1,1,0,0,0);

        Collections.shuffle(nums);
        System.out.println(nums);

        Random random = new Random();
        int index = random.nextInt(nums.size());
        int number = nums.get(index);
        System.out.println(number);


        ArrayList<String> boyLists = new ArrayList<>();
        ArrayList<String> girlLists = new ArrayList<>();
        Collections.addAll(boyLists,"张三","李四","王五","赵六","刘七","男1","男2");
        Collections.addAll(girlLists,"女1","女2","女3");

        if(number == 1){
            int indexBoy = random.nextInt(boyLists.size());
            System.out.println(boyLists.get(indexBoy));
        }else{
           int indexGirl = random.nextInt(girlLists.size());
            System.out.println(girlLists.get(indexGirl));
        }



    }
}
